<template>
  <div>
    <div class="commentItem">
        <div class="top">
            <div class="left">
                <span>{{parent.user.nickname}}</span> &nbsp;&nbsp;&nbsp;
                <span>{{parent.create_date}}</span>
            </div>
            <span @click="replyFn(parent.id)">回复</span>
            </div>
            <commentItem v-if="parent.parent" :parent="parent.parent" @replyEvent="replyFn"></commentItem>
    <div class="bottom">{{parent.content}}</div>
</div></div>
</template>

<script>
export default {
    name:'commentItem',
    props:{
        parent:{
            type:Object,
            require:true
        }
    },
    methods:{
        replyFn(id){
            this.$emit('replyEvent',id)
        }
    }
}
</script>

<style lang="less" scoped>
.commentItem {
  border: 1px solid #ccc;
  padding: 5px;
  margin-top: 10px;
  .top {
    font-size: 12px;
    color: #aaa;
    display: flex;
    justify-content: space-between;
  }
  .bottom {
    font-size: 13px;
    line-height: 40px;
  }
}
</style>